<?php

namespace app\model;

use think\Model;

class Commentquestion extends Model
{


    protected $connection = 'mysql';

    protected $pk = 'id';

    protected $name = 'commentquestion';

    public static function gettidname($item)
    {
        $data[1] = "业务员评价";
        $data[2] = "公司的评价";

        return $data[$item];
    }

    public static function getdatalistbytid($tid)
    {
        $where['weid'] = weid();
        $where['tid'] = $tid;
        $data = self::where($where)
            ->order('sort asc')->select()->toArray();

        foreach ($data as &$vo) {

            if ($vo['ptype'] == 1) {
                $vo['content'] = explode(',', $vo['content']);
                $vo['contentse'] = $vo['content'][count($vo['content']) - 1];
            } else {
                $vo['userStars'] = [
                    "/static/images/rwjx.png",
                    "/static/images/rwjx.png",
                    "/static/images/rwjx.png",
                    "/static/images/rwjx.png",
                    "/static/images/rwjx.png"
                ];
                $vo['wjxScore'] = 5;
            }
        }
        return $data;
    }
}
